home *** CD-ROM | disk | FTP | other *** search
- 0, In this demonstration you will learn how to create
- 4, an initialization event for a Web page using
- 7, Visual InterDev. Open the page you want to add the
- 11, initialization script to with the Visual InterDev
- 14, Source Editor. There are two places where you can add
- 17, initialization code in a Web page. If you add
- 21, code in a script section that is not included inside
- 25, of a procedure it will run when the browser
- 27, reaches that section as it is reading the file. For
- 31, example, this code sets a variable and then calls
- 34, msgbox to output the value of the variable. The second
- 39, place you can add initialization code to is the
- 42, OnLoad event of the Window object. So, in the
- 46, script section I can create an event procedure named
- 49, "window_onload." In the event procedure I can add
- 60, any VBScript code I want. For example, I can declare
- 64, another variable "y," assign it a value, and use
- 71, msgbox to output it. Any code inside the
- 78, window_onload event procedure will run after the browser is
- 83, done loading the page and therefore after any
- 86, other initialization code included in the script
- 89, section, but not included in a procedure. Let's save
- 93, this file and view it with the Visual InterDev
- 96, browser. Notice that the message box from the
- 104, initialization code in the script section displays first,
- 108, displaying the value of 5. When I dismiss the
- 110, message box the message box from the window_onload
- 114, event runs at the same time that the page is loaded,
- 117, displaying the value of "hi." So, now you know how
- 122, to add initialization code to a Web page using
- 125, the window_onload event.
- 127, END